**************************************************************
***
***	INTERTEMPORAL EVIDENCE ON THE STRATEGY OF POPULISM IN THE US (Gennaro, Lecce, Morelli)
***	Replication Package
***  
*** Table 2
***
**************************************************************


clear
est clear 

* Indicate location of the replication package here
cd "/Replication Package"

**********************************************
* Upload Data                            *****
**********************************************


use "3_data/for_analysis/congress_election_both.dta", clear

**********************************************
* Variables and sample                   *****
**********************************************

* Sample
keep if uncont==0 & indep==0

* Model
local outvar "pop_dim2_s"
local controls "female i.age_cat_num i.ethnicity2 i.educ_cat len_words i.election_year"


**********************************************
* Results                                *****
**********************************************

est clear 

* Democrats
eststo: areg `outvar' i.outsider_correct##i.competitivedistricts##c.econ `controls'  if republican==0, a(state) cluster(district)
eststo: areg `outvar' i.outsider_correct##i.competitivedistricts##c.econ `controls'  if republican==0 & sanders==1, a(state) cluster(district)
eststo: areg `outvar' i.outsider_correct##i.competitivedistricts##c.econ `controls'  if republican==0 & sanders==0, a(state) cluster(district)

* Republicans
eststo: areg `outvar' i.outsider_correct##i.competitivedistricts##c.econ `controls'  if republican==1, a(state) cluster(district)
eststo: areg `outvar' i.outsider_correct##i.competitivedistricts##c.econ `controls'  if republican==1&trump_poll==1, a(state) cluster(district)
eststo: areg `outvar' i.outsider_correct##i.competitivedistricts##c.econ `controls'  if republican==1&trump_poll==0, a(state) cluster(district)

* Save
esttab _all using "4_results/tables/tab2.tex", f label replace booktabs alignment(D{.}{.}{-1}) ///
keep(1.outsider_correct 1.competitivedistricts econ 1.outsider_correct#1.competitivedistricts 1.outsider_correct#c.econ 1.competitivedistricts#c.econ  1.outsider_correct#1.competitivedistricts#c.econ) ///
s(N r2, fmt(0 2) label("Observations" "R-squared")) nomtitles star(* 0.10 ** 0.05 *** 0.01) r2 b(3) se(3) brac nonotes
